package com.softtown.modules.sys.service.impl;

import com.softtown.common.service.impl.BaseServiceImpl;
import com.softtown.modules.sys.dao.CompSysRoleMenuDao;
import com.softtown.modules.sys.entity.CompSysRoleMenuEntity;
import com.softtown.modules.sys.service.CompSysRoleMenuService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 公司角色菜单
 *
 * @author Dingyayong
 * @version v1.0
 * @create 2019-05-28 15:11
 **/
@Service
public class CompSysRoleMenuServiceImpl extends BaseServiceImpl<CompSysRoleMenuDao, CompSysRoleMenuEntity> implements CompSysRoleMenuService{

    @Override
    public List<CompSysRoleMenuEntity> getCompMenuByRole(Long companyId, Long roleId) {
        return baseDao.getListByCompIdAndRoleId(companyId, roleId);
    }
    @Override
    public List<CompSysRoleMenuEntity> getCompMenuByRoles(Long companyId, List<Long> roleId) {
        return baseDao.getListByCompIdAndRoleIds(companyId, roleId);
    }

    @Override
    public List<CompSysRoleMenuEntity> getByRoleId(Long roleId) {
        return baseDao.getByRoleId(roleId);
    }

    @Override
    public List<Long> getMenuIdList(Long roleId) {
        return baseDao.getMenuIdList(roleId);
    }

    @Override
    public CompSysRoleMenuEntity getRoleMenu(Long compId, Long roleId, Long menuId) {
        return baseDao.getRoleMenu(compId,roleId,menuId);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateRoleMenu(CompSysRoleMenuEntity compSysRoleMenuEntity) {
        baseDao.updateRoleMenu(compSysRoleMenuEntity);
    }
}

